#异常处理（捕获）
# try：
# 容易发生错误的代码块
# except 异常类：
# 发生异常时错做的事情
# else：
# 未发生异常时错做的事情
#
# Finally:
# 不管是否发生异常均做的事情
# from day321 import JSQ321
import openpyxl.workbook
from openpyxl.workbook import Workbook
from openpyxl.worksheet.worksheet import Worksheet

from hmwk.mym19 import DoData


class DoF():
    def rrread(self,f,m,isUTF=False):
        if isUTF:
            with open(f,m,encoding='utf-8') as ff:
                return ff.read()
        else:
            with open(f,m) as ff:
                return ff.read()
    def wwrite(self,f,m,s,isUTF=False):
        if isUTF:
            with open(f,mode=m) as ff:
                ff.write(s)
        else:
            with open(f,mode=m,encoding='utf-8') as ff:
                ff.write(s)

    def doExecl(self,f,sn,minr,maxr,minc,maxc):
        wk: Workbook = openpyxl.load_workbook(f)
        st: Worksheet = wk[sn]
        # s=st.values
        # print(s)
        b = st.iter_rows(minr,maxr,minc,maxc,values_only=True)
        l = [i for i in b]
        return l



if __name__ == '__main__':
    jsq=JiSQ()
    # print(jsq.jia(a=1.55,b='b=-1.333'))
    print(jsq.jia(a='',b='c'))




# f1=r'E:\dev\python\project\homeWorkPro\datas\新建 文本文档 (2).txt'
# m1='a'
# s1='\n派森'
#
# fWrite().wwrite(f1,m1,s1,True)
# print(fRead().rrread(f=r'E:\dev\python\project\homeWorkPro\datas\286ad82014056e7b1ec33b787077461.png',m='r+b'))

# f2=r'E:\dev\python\project\homeWorkPro\datas\286ad82014056e7b1ec33b787077461.png'
# f3=r'E:\dev\python\project\homeWorkPro\datas\newp.png'
# s2=fDoF().rrread(f=r'E:\dev\python\project\homeWorkPro\datas\286ad82014056e7b1ec33b787077461.png',m='r+b')
# m2='w+b'
# DoF().wwrite(f3,m2,s2)

# f=r'E:\dev\python\project\homeWorkPro\datas\15题.xlsx'
# DoF.doExecl(f)

